<Page Background="#FF606060"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Page.Resources>
    <Style x:Key="ChromeMainButton" TargetType="{x:Type Button}">
      <Setter Property="Width" Value="120" />
      <Setter Property="Height" Value="32" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type Button}">
            <Grid>
              <Border HorizontalAlignment="Left" Width="115" x:Name="ButtonBackground" CornerRadius="4,0,0,0">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0.0" Color="#FFFFE000" />
                    <GradientStop Offset="1.0" Color="#FFFF9A00" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              <Border HorizontalAlignment="Left" Margin="115,0,0,0" Width="5">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                    <GradientStop Offset="0.0" Color="#80000000" />
                    <GradientStop Offset="1.0" Color="#00000000" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              <Grid HorizontalAlignment="Left" Width="115" Margin="0,-2,0,0">
                <Label VerticalAlignment="Center" HorizontalAlignment="Center" Content="Tacitus" FontSize="22px" Padding="0" Foreground="#FF333333" x:Name="Caption">
                  <Label.BitmapEffect>
                    <DropShadowBitmapEffect ShadowDepth="0.25" Color="#FF000000" Softness="0.1" Direction="120" />
                  </Label.BitmapEffect>
                </Label>
                <Label x:Name="LightShadow" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding ElementName=Caption, Path=Content}" FontSize="{Binding ElementName=Caption, Path=FontSize}" Foreground="{Binding ElementName=Caption, Path=Foreground}" Padding="0">
                  <Label.BitmapEffect>
                    <DropShadowBitmapEffect ShadowDepth="0.25" Color="#FFFFFFFF" Softness="0.1" />
                  </Label.BitmapEffect>
                </Label>
              </Grid>
            </Grid>
            <ControlTemplate.Triggers>
              <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="ButtonBackground" Property="RenderTransform">
                  <Setter.Value>
                    <ScaleTransform CenterX="0" CenterY="16" ScaleX="1" ScaleY="-1" />
                  </Setter.Value>
                </Setter>
                <Setter TargetName="Caption" Property="BitmapEffect">
                  <Setter.Value>
                    <DropShadowBitmapEffect ShadowDepth="0.25" Color="#FFFFFFFF" Softness="0.1" Direction="120" />
                  </Setter.Value>
                </Setter>
                <Setter TargetName="LightShadow" Property="BitmapEffect">
                  <Setter.Value>
                    <DropShadowBitmapEffect ShadowDepth="0.25" Color="#FF000000" Softness="0.1" />
                  </Setter.Value>
                </Setter>
                <Setter TargetName="ButtonBackground" Property="CornerRadius" Value="0,0,0,4" />
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="ChromeTitle" TargetType="{x:Type Label}">
      <Setter Property="Foreground" Value="#FFFFFFFF" />
      <Setter Property="BitmapEffect">
        <Setter.Value>
          <OuterGlowBitmapEffect GlowColor="#FF000000" GlowSize="5" Opacity="0.25" />
        </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="ChromeMinButton" TargetType="{x:Type Button}">
      <Setter Property="Width" Value="30" />
      <Setter Property="Height" Value="20" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type Button}">
            <Grid>
              <!-- Glow -->
              <Border CornerRadius="8" BorderThickness="0,0,0,0" Background="#FFC0C0C0" IsHitTestVisible="False" VerticalAlignment="Stretch" Opacity="0" x:Name="BackgroundGlow">
                <Border.BitmapEffect>
                  <BlurBitmapEffect Radius="16" />
                </Border.BitmapEffect>
              </Border>
              
              <!-- Background -->
              <Border CornerRadius="0,0,0,3" BorderThickness="0,0,0,0" Margin="1,1,0,1" IsHitTestVisible="True" VerticalAlignment="Stretch" x:Name="BackgroundBorder">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.60" x:Name="BackgroundGradient">
                    <GradientStop Offset="0.0" Color="#FF808080" />
                    <GradientStop Offset="1.0" Color="#FF333333" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              
              <!-- Glyph -->
              <Grid IsHitTestVisible="False">
                <Path Data="M 0,6 L 9,6 L 9,8 L 0,8 Z" Stroke="#80FFFFFF" StrokeThickness="1" Fill="#FFFFFFFF" Margin="2,-1,0,0" Width="10" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="Glyph1">
                  <Path.BitmapEffect>
                    <OuterGlowBitmapEffect GlowSize="2" GlowColor="#FF000000" Opacity="0.5" x:Name="GlyphGlow" />
                  </Path.BitmapEffect>
                </Path>
              </Grid>
              
              <!-- Frame -->
              <Border CornerRadius="0,0,0,4" BorderBrush="#A0000000" Opacity="0.8" BorderThickness="1,0,0,1" Margin="0,0,0,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,0,0" BorderBrush="#A0FFFFFF" Opacity="0.8" BorderThickness="0,1,0,0" Margin="1,0,0,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,0,3" BorderBrush="#80FFFFFF" Opacity="0.8" BorderThickness="1,0,1,1" Margin="1,1,0,1" IsHitTestVisible="False" />
            </Grid>
            <ControlTemplate.Triggers>
              <EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.7" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="0.6" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="BackgroundBorder" Property="CornerRadius" Value="3,0,0,0" />
                <Setter TargetName="BackgroundBorder" Property="RenderTransform">
                  <Setter.Value>
                    <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="0" CenterY="9" />
                  </Setter.Value>
                </Setter>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="ChromeMaxRestoreButton" TargetType="{x:Type ToggleButton}">
      <Setter Property="Width" Value="30" />
      <Setter Property="Height" Value="20" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToggleButton}">
            <Grid>
              <!-- Glow -->
              <Border CornerRadius="8" BorderThickness="0,0,0,0" Background="#FFC0C0C0" IsHitTestVisible="False" VerticalAlignment="Stretch" Opacity="0" x:Name="BackgroundGlow">
                <Border.BitmapEffect>
                  <BlurBitmapEffect Radius="16" />
                </Border.BitmapEffect>
              </Border>
              
              <!-- Background -->
              <Border CornerRadius="0,0,0,0" BorderThickness="0,0,0,0" Margin="1,1,0,1" IsHitTestVisible="True" VerticalAlignment="Stretch" x:Name="BackgroundBorder">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.60" x:Name="BackgroundGradient">
                    <GradientStop Offset="0.0" Color="#FF808080" />
                    <GradientStop Offset="1.0" Color="#FF333333" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              
              <!-- Glyph -->
              <Grid IsHitTestVisible="False">
                <Path Data="M 0,0 L 10,0 L 10,8 L 0,8 L 0,1 L 1,1 L 1,7 L 9,7 L 9,1 L 1,1 L 0,1" Stroke="#80FFFFFF" StrokeThickness="1" Fill="#FFFFFFFF" Margin="3,-3,0,0" Width="10" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="Glyph1">
                  <Path.BitmapEffect>
                    <OuterGlowBitmapEffect GlowSize="2" GlowColor="#FF000000" Opacity="0.5" x:Name="GlyphGlow" />
                  </Path.BitmapEffect>
                </Path>
                <Path Data="M 0,0 L 10,0 L 10,8 L 0,8 L 0,1 L 1,1 L 1,7 L 9,7 L 9,1 L 1,1 L 0,1" Stroke="#80FFFFFF" StrokeThickness="1" Fill="#FFFFFFFF" Margin="-2,1,0,0" Width="10" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="Glyph2">
                  <Path.BitmapEffect>
                    <OuterGlowBitmapEffect GlowSize="2" GlowColor="#FF000000" Opacity="{Binding ElementName=GlyphGlow, Path=Opacity}" />
                  </Path.BitmapEffect>
                </Path>
              </Grid>
              
              <!-- Frame -->
              <Border CornerRadius="0,0,0,0" BorderBrush="#A0000000" Opacity="0.8" BorderThickness="1,0,0,1" Margin="0,0,0,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,0,0" BorderBrush="#A0FFFFFF" Opacity="0.8" BorderThickness="0,1,0,0" Margin="1,0,0,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,0,0" BorderBrush="#80FFFFFF" Opacity="0.8" BorderThickness="1,0,1,1" Margin="1,1,0,1" IsHitTestVisible="False" />
            </Grid>
            <ControlTemplate.Triggers>
              <EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.7" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="0.6" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="BackgroundBorder" Property="CornerRadius" Value="0,0,0,0" />
                <Setter TargetName="BackgroundBorder" Property="RenderTransform">
                  <Setter.Value>
                    <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="0" CenterY="9" />
                  </Setter.Value>
                </Setter>
              </Trigger>
              <Trigger Property="IsChecked" Value="False">
                <Setter TargetName="Glyph2" Property="Visibility" Value="Hidden" />
                <Setter TargetName="Glyph1" Property="Margin" Value="1,-1,0,0" />
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="ChromeCloseButton" TargetType="{x:Type Button}">
      <Setter Property="Width" Value="50" />
      <Setter Property="Height" Value="20" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type Button}">
            <Grid>
              <!-- Glow -->
              <Border CornerRadius="16" BorderThickness="0,0,0,0" Background="#FFFFE000" IsHitTestVisible="False" VerticalAlignment="Stretch" Opacity="0" x:Name="BackgroundGlow">
                <Border.BitmapEffect>
                  <BlurBitmapEffect Radius="16" />
                </Border.BitmapEffect>
              </Border>
              
              <!-- Background -->
              <Border CornerRadius="0,0,3,0" BorderThickness="0,0,0,0" Margin="1,1,1,1" IsHitTestVisible="True" VerticalAlignment="Stretch" x:Name="BackgroundBorder">
                <Border.Background>
                  <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.60" x:Name="BackgroundGradient">
                    <GradientStop Offset="0.0" Color="#FFFFE000" />
                    <GradientStop Offset="1.0" Color="#FFFF9A00" />
                  </LinearGradientBrush>
                </Border.Background>
              </Border>
              
              <!-- Glyph -->
              <Border IsHitTestVisible="False">
                <Path Data="M 0,0 L 2,0 L4,2 L6,0 L8,0 L6,3 L6,4 L8,7 L6,7 L4,4 L2,7 L0,7 L2,4 L2,3 Z" Stroke="#80FFFFFF" StrokeThickness="1" Fill="#FFFFFFFF" Margin="2,0,0,0" Width="9" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center">
                  <Path.BitmapEffect>
                    <OuterGlowBitmapEffect GlowSize="2" GlowColor="#FF000000" Opacity="0.5" x:Name="GlyphGlow" />
                  </Path.BitmapEffect>
                </Path>
                
              </Border>
              
              <!-- Frame -->
              <Border CornerRadius="0,0,4,0" BorderBrush="#A0000000" Opacity="0.8" BorderThickness="1,0,1,1" Margin="0,0,0,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,0,0" BorderBrush="#A0FFFFFF" Opacity="0.8" BorderThickness="0,1,0,0" Margin="1,0,1,0" IsHitTestVisible="False" />
              <Border CornerRadius="0,0,3,0" BorderBrush="#80FFFFFF" Opacity="0.8" BorderThickness="1,0,1,1" Margin="1,1,1,1" IsHitTestVisible="False" />
            </Grid>
            <ControlTemplate.Triggers>
              <EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.7" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="1.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
                <EventTrigger.Actions>
                  <BeginStoryboard>
                    <Storyboard>
                      <DoubleAnimation To="0.6" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="BackgroundGlow" Storyboard.TargetProperty="Opacity" />
                      <DoubleAnimation To="0.0" Duration="00:00:00.250" Storyboard.TargetName="GlyphGlow" Storyboard.TargetProperty="Opacity" />
                    </Storyboard>
                  </BeginStoryboard>
                </EventTrigger.Actions>
              </EventTrigger>
              <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="BackgroundBorder" Property="CornerRadius" Value="0,3,0,0" />
                <Setter TargetName="BackgroundBorder" Property="RenderTransform">
                  <Setter.Value>
                    <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="0" CenterY="9" />
                  </Setter.Value>
                </Setter>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </Page.Resources>
  <Border CornerRadius="4" Width="400" Height="300" Background="#FF333333">
    <Border.BitmapEffect>
      <DropShadowBitmapEffect ShadowDepth="2" Softness="2" Color="#FF000000" Opacity="0.75" />
    </Border.BitmapEffect>
    <Grid>
      <Border BorderBrush="#FF808080" BorderThickness="1,1,1,1" Margin="0,32,0,0" CornerRadius="0,0,4,4" />
      <Border BorderBrush="#FFA0A0A0" BorderThickness="1,1,1,0" CornerRadius="4,4,0,0" Height="32" VerticalAlignment="Top">
        <Border.Background>
          <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
              <GradientStop Offset="0" Color="#FF808080" />
              <GradientStop Offset="1" Color="#FF555555" />
          </LinearGradientBrush>
        </Border.Background>
        <Grid Height="32" ClipToBounds="True" VerticalAlignment="Top" Margin="0">  
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="120" />
            <ColumnDefinition />
            <ColumnDefinition Width="113" />
          </Grid.ColumnDefinitions>
          <Button Style="{StaticResource ChromeMainButton}" />
          <Label Style="{StaticResource ChromeTitle}" Content="TestWindow" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="8,0,0,0" Padding="0" Grid.Column="1" />
          <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Top">
            <Button Style="{StaticResource ChromeMinButton}" />
            <ToggleButton Style="{StaticResource ChromeMaxRestoreButton}" />
            <Button Style="{StaticResource ChromeCloseButton}" />
          </StackPanel>
        </Grid>
      </Border>
    </Grid>
  </Border>
</Page>